package Arithmetic;

public class recursion {
    public static void main(String[] args) {
        System.out.println(Fibonacci(15));
    }

    //斐波那契数列
    public static int Fibonacci(int num) {
        if (num == 2 || num == 1) {
            return 1;
        } else {
            return Fibonacci(num - 1) + Fibonacci(num - 2);
        }
    }

    public static int getSum(int num) {
        if (num == 1) {
            return 1;
        } else {
            return num + getSum(num - 1);
        }
    }

    public static int getMulSum(int num) {
        if (num == 1) {
            return num;
        } else {
            return num * getMulSum(num - 1);
        }
    }
}
